Generally caching of block device data at a relatively lower latency device provides phenomenal performance for both read and write input/output (“I/O”) operations. As a read cache device, the data is stored in the cache device until it is replaced with the new data. Until then, the data is read from the cache device for subsequent read I/O operations directed to the same data block. As a write cache, the new data is written to the cache device, and the write I/O operation is informed completed. Later based on policy, the dirty data stored in the cache device is actually persisted to the underlying stable medium. In write-back mode, until the data is persisted to the underlying stable medium, the data in the cache device cannot be guaranteed to be available in future, for example, if the cache device is volatile across power cycle.
Using a solid state device (“SSD”) as the cache device helps solve the above problem. For example, using an SSD cache device helps to protect the data during power interruption. Since the SSD is a stable medium, the data availability across power cycle is always guaranteed. When compared to a hard disk drive, SSD devices have phenomenal read and write performance. However, various characteristics of the SSD devices may reduce the I/O performance over time.
The systems, devices and methods described herein use a plurality of SSDs as a caching medium for a data storage system. In particular, the systems, devices and methods use the SSDs in both a write-through cache mode and a write-back cache mode, for example, by splitting the SSDs into a plurality of cache regions and controlling each of the cache regions according to a different cache modes. Cache regions can include at least a portion of each of the SSDs. Additionally, the sizes of the cache regions are dynamically controlled based on the I/O load on the data storage system.
For example, one cache region of the SSDs controlled according to a write-through mode can be used a read cache. The data in this cache region can be striped across the SSDs. Another cache region of the SSDs controlled according to a write-back mode can be used a write cache. The data in this cache region can be mirrored across the SSDs. By mirroring the data in the cache region of the SSDs controlled according to the write-back mode, the data, which may not have been flushed or persisted to the data storage system, is protected in the event of failure of one of the SSDs.
An example computer-implemented method for using a plurality of SSDs as a caching medium in a data storage system can include splitting the SSDs into a plurality of cache regions, maintaining a first cache region of the SSDs as a write-through cache and maintaining a second cache region of the SSDs as a write-back cache. Additionally, data stored in the first cache region can be striped across the SSDs, and data stored in the second cache region can be mirrored across the SSDs. The computer-implemented method can also include dynamically adjusting a size of at least one of the first and second cache regions of the SSDs based on an input/output (“I/O”) load of the data storage system.
For example, to dynamically adjust a size of at least one of the first and second cache regions of the SSDs, the computer-implemented method can include expanding a size of the second cache region as the I/O load of the data storage system increases. Alternatively or additionally, the computer-implemented method can include reducing a size of the second cache region as the I/O load of the data storage system decreases.
Optionally, the computer-implemented method can include detecting failure of at least one of the SSDs, and upon detecting the failure, persisting one or more blocks of data stored in the second cache region of an operational SSD to the data storage system. The computer-implemented method can also include maintaining the second cache region of the operational SSD as a write-through cache.
Additionally, upon restoring or replacing the failed SSD, the computer-implemented method can optionally further include restoring the second cache region of the operational SSD to operation as a write-back cache.
Optionally, the computer-implemented method can include tracking valid data stored in the first cache region of the SSDs without maintaining a valid bitmap. For example, the computer-implemented method can include, for each read I/O operation that is not previously stored in the first cache region of the SSDs and that requests a data chunk with a size less than an SSD block size from the data storage system, reading a data block from the data storage system including the data chunk, where the data block has a size equal to the SSD block size. The computer-implemented method can then include storing the data block in the first cache region of the SSDs.
Optionally, the computer-implemented method can include tracking dirty data stored in the second cache region of the SSDs with a dirty bitmap for each SSD block of the second cache region of the SSDs, where each bit in the dirty bitmap corresponds to an SSD page size. For example, the computer-implemented method can include, for each write I/O operation directed to a data chunk with a size less than the SSD page size in the data storage system, reading a data block with a size equal to the SSD page size from the data storage system, where the data block includes the data chunk. The computer-implemented method can then include modifying the data block according to the write I/O operation and storing the modified data block in the second cache region of the SSDs.
Optionally, the computer-implemented method can include receiving a TRIM command from the data storage system in response to invalidation of one or more cache lines of the SSDs and wiping the invalidated cache lines from the first cache region of the SSDs. Alternatively or additionally, the computer-implemented method can include receiving a TRIM command from the data storage system in response to flushing one or more cache lines of the SSDs and wiping the flushed cache lines from the second cache region of the SSDs.
Optionally, the first cache region of the SSDs can be maintained as a RAID 0 array. Alternatively or additionally, the second cache region of the SSDs can be maintained as a RAID 1 array.
It should be understood that the above-described subject matter may also be implemented as a computer-controlled apparatus, a computer process, a computing system, or an article of manufacture, such as a computer-readable storage medium.
Other systems, methods, features and/or advantages will be or may become apparent to one with skill in the art upon examination of the following drawings and detailed description. It is intended that all such additional systems, methods, features and/or advantages be included within this description and be protected by the accompanying claims.